<%@ Page Language="C#" MasterPageFile="~/cms.master" AutoEventWireup="true" CodeFile="MissingProducts.aspx.cs"
    Inherits="MissingProducts" Title="<%$Resources:Language,CmsMissingProductsTitle %>" %>

<%@ Register Src="~/controls/ctrlShowInfo.ascx" TagName="ctrlShowInfo" TagPrefix="ctrl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="Server">
    <h2>
        <%=Resources.Language.ProductsDeficiencies %></h2>
    <ctrl:ctrlShowInfo ID="ctrlShowInfo" runat="server" />
    <table class="cmsTables" cellspacing="0" style="text-align: left">
        <asp:Repeater ID="rptRealizationWithMissingProducts" runat="server" OnItemDataBound="rptRealizationWithMissingProducts_ItemDataBound"
            EnableViewState="false">
            <ItemTemplate>
                <tr>
                    <th>
                        ID<%# Eval("IDrealization") %>
                    </th>
                    <th colspan="2">
                        <a href='OrderEdit.aspx?RealizationID=<%# Eval("IDrealization") %>'>
                            <%# ((ShopModel.Realization)Container.DataItem).iCustomer.FirstName %>
                            <%# ((ShopModel.Realization)Container.DataItem).iCustomer.Surname %>
                        </a>
                    </th>
                    <th colspan="2" align="right">
                        <%# ((ShopModel.Realization)Container.DataItem).StartDate %>
                    </th>
                </tr>
                <asp:Repeater ID="rptMissingProducts" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td style="border-width: 0px;">
                            </td>
                            <td style="border-width: 0px;">
                                <%# ((ShopModel.ProductBatch)Container.DataItem).ProductId %>
                            </td>
                            <td style="border-width: 0px;">
                                <%# ((ShopModel.ProductBatch)Container.DataItem).ProductName %>
                            </td>
                            <td style="border-width: 0px;">
                                <%=Resources.Language.Available %>:
                                <%# ((ShopModel.ProductBatch)Container.DataItem).AvailableCount %>
                            </td>
                            <td style="border-width: 0px;">
                                <%=Resources.Language.Ordered %>:
                                <%# ((ShopModel.ProductBatch)Container.DataItem).Count %>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </ItemTemplate>
        </asp:Repeater>
    </table>
    <br />
    <br />
    <asp:GridView ID="gvMissingProductsCount" runat="server" AutoGenerateColumns="false"
        CssClass="cmsTables">
        <Columns>
            <asp:BoundField DataField="ProductName" HeaderText="<%$Resources:Language,Name %>" />
            <asp:BoundField DataField="Count" HeaderText="<%$Resources:Language,Ordered %>" />
            <asp:BoundField DataField="AvailableCount" HeaderText="<%$Resources:Language,Available %>" />
            <asp:TemplateField HeaderText="<%$Resources:Language,Missing %>">
                <ItemTemplate>
                    <%# ((Convert.ToInt32(Eval("AvailableCount"))-Convert.ToInt32(Eval("Count"))))<0 ? Math.Abs((Convert.ToInt32(Eval("AvailableCount"))-Convert.ToInt32(Eval("Count")))):0 %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <br />
</asp:Content>
